cmake_minimum_required(VERSION 3.5)
project(autonomous_attack_algorithm)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()
set(CMAKE_BUILD_TYPE "Debug")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(rclcpp REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geographic_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_sensor_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(image_transport REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(mavros_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(yolo_detect_message REQUIRED)
find_package(client_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(rosidl_typesupport_cpp REQUIRED)
if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # uncomment the line when a copyright and license is not present in all source files
  #set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # uncomment the line when this package is not in a git repo
  #set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()
include_directories(
  include
)
# Define the library
add_library(autonomous_attack 
  src/autonomous_attack.cpp
)

# Link libraries
# target_link_libraries(autonomous_attack 
#   ${EIGEN3_LIBRARIES}  # 使用 ${EIGEN3_LIBRARIES}
# )

ament_target_dependencies(autonomous_attack
cv_bridge
  yolo_detect_message
  rclcpp
  sensor_msgs
  std_msgs
  image_transport
  mavros_msgs
  client_interfaces
  geometry_msgs
  nav_msgs
)

# Define the executable
add_executable(autonomous_attack_algorithm_node
  src/autonomous_attack_algorithm_node.cpp)

target_link_libraries(autonomous_attack_algorithm_node autonomous_attack)

ament_target_dependencies(autonomous_attack_algorithm_node 
cv_bridge
yolo_detect_message
rclcpp
sensor_msgs
std_msgs
image_transport
mavros_msgs
client_interfaces
geometry_msgs
nav_msgs
)

# Install rules
install(TARGETS autonomous_attack_algorithm_node autonomous_attack
  RUNTIME DESTINATION lib/${PROJECT_NAME}
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
)

install(DIRECTORY launch config DESTINATION share/${PROJECT_NAME})
ament_package()
